package top.yueyazhui.vhr.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.yueyazhui.vhr.bean.Response;
import top.yueyazhui.vhr.mapper.PositionMapper;
import top.yueyazhui.vhr.model.Position;

import java.util.Date;
import java.util.List;

@Service
public class PositionService {

    @Autowired
    PositionMapper positionMapper;

    public List<Position> getAll() {
        return positionMapper.getAll();
    }

    public Integer insert(Position position) {
        position.setEnabled(true);
        position.setCreateDate(new Date());
        return positionMapper.insertSelective(position);
    }

    public Integer update(Position position) {
        return positionMapper.updateByPrimaryKeySelective(position);
    }

    public Integer delete(Integer id) {
        return positionMapper.deleteByPrimaryKey(id);
    }

    public Integer batchDelete(Integer[] ids) {
        return positionMapper.batchDeleteByPrimaryKeys(ids);
    }
}
